const Sequelize = require('sequelize');
const sequelize = require('../libs/sequelize')

const User = sequelize.define('user', {
    id: {
        type: Sequelize.INTEGER,
        allowNull: true,
        primaryKey: true,
        autoIncrement: true
    },
    name: {
        type: Sequelize.STRING
    },
    avatar: {
        type: Sequelize.STRING,
        allowNull: true
    },
    nickname: {
        type: Sequelize.STRING,
        allowNull: true
    },
    listenCount: {
        type: Sequelize.INTEGER,
        allowNull: true
    },
    fansCount: {
        type: Sequelize.INTEGER
    }
});




// User.create({
//     name: 'aa',
//     avatar: 'asdfasdf',
//     nickname: 'bbb',
//     fansCount: 23,
//     listenCount: 2323,
// });


// User.findAll().then(users => {
//     console.log(users)
// })

//User.findById(2).then(user => console.log(user.id))

// User.findOne({
//     name: 'aa'
// }).then(user => console.log(user))

// User.update({
//     name: 'bbb'

// }, {
//     where: {
//         id: 1
//     }
// })

// User.findOne({
//     id: 1
// }).then(function(user) {
//     console.log(user)
// })

module.exports = User